import { _decorator, AudioClip, AudioSource, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('Music')
export class Music extends Component {
    /**
     * 移动音效
     */
    @property(AudioClip)
    moveAudio: AudioClip =null

    /**
     * 旋转音效
     */
    @property(AudioClip)
    changeAudio: AudioClip =null

    /**
     * 消除音效
     */
    @property(AudioClip)
    eliminateAudio: AudioClip =null

    /**
     * 游戏结束音效
     */
    @property(AudioClip)
    gameOverAudio: AudioClip =null

    /**
     * 播放移动音效
     */
    playMoverAudio() {
        this.node.getComponent(AudioSource).playOneShot(this.moveAudio)
    }

     /**
     * 播放旋转音效
     */
     playChangeAudio() {
        this.node.getComponent(AudioSource).playOneShot(this.changeAudio)
    }

    /**
     * 播放消除音效
     */
    playEliminateAudio() {
        this.node.getComponent(AudioSource).playOneShot(this.eliminateAudio)
    }

    /**
     * 播放游戏结束音效
     */
    playGameOverAudio() {
        this.node.getComponent(AudioSource).playOneShot(this.gameOverAudio)
    }
}


